package com.le.tester.javaThink.fifth.chapter24_ConcurrentProgramming;

import java.util.stream.IntStream;

/**
 * createTime：2021/8/24 11:27
 * description：PizzaStreams
 */
public class PizzaStreams {
    static final int QUANTITY = 5;

    public static void main(String[] args) {
        IntStream.range(0, QUANTITY)
                .mapToObj(Pizza::new)
                .parallel()
                .forEach(pizza -> {
                    while (!pizza.complete()) {
                        pizza.next();
                    }
                });
    }
}
